﻿<!DOCTYPE html>
<!--HTML5 doctype-->
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<title>收货地址 - {site.name}</title>
<meta name="keywords" content="{site.seo_keyword}" />
<meta name="description" content="{site.seo_description}" />
<link rel="stylesheet" type="text/css" href="<%templateskin%>/css/style.css" />
<link rel="stylesheet" type="text/css" href="<%templateskin%>/css/validate.css" />
<script type="text/javascript" charset="utf-8" src="<%templateskin%>/js/zepto.min.js"></script>
<script type="text/javascript" charset="utf-8" src="<%templateskin%>/js/weui.min.js"></script>
<script type="text/javascript" charset="utf-8" src="<%templateskin%>/js/common.js"></script>
<script type="text/javascript" charset="utf-8" src="{config.webpath}scripts/jquery/PCASClass.js"></script>
<script type="text/javascript" charset="utf-8" src="<%templateskin%>/js/mvalidate.js"></script>
<script type="text/javascript" charset="utf-8" src="<%templateskin%>/js/mvalidate-extend.js"></script>
<script type="text/javascript">
    $(function(){
        //初始化表单
        AjaxInitForm('#editForm', '#btnSubmit', 1, '#turl');
    });
</script>
</head>

<body ontouchstart>
<div class="page">
    <!--页面头部-->
    <div class="header">
        <a class="back" href="javascript:history.back();">
            <i class="iconfont icon-arrow-left"></i>
        </a>
        <h3>编辑地址簿</h3>
        <div class="right"> 
            <a class="weui-cell_access weui-cell_link" href="<%linkurl("usercenter","index")%>">
                <i class="iconfont icon-user"></i>
            </a>
        </div>
    </div>
    <!--/页面头部-->
  
    <!--页面内容-->
    <div class="page__bd">
        <%if(action=="edit")%>
        <!--编辑地址-->
        <script type="text/javascript">
            $(function(){
                //初始化地区
                var mypcas = new PCAS("txtProvince,所属省份", "txtCity,所属城市", "txtArea,所属地区");
                var areaArr = ("{model.area}").split(",");
                if (areaArr.length == 3) {
                    mypcas.SetValue(areaArr[0], areaArr[1], areaArr[2]);
                }
            });
        </script>
        <form id="editForm" name="editForm" class="form-box" url="{config.webpath}tools/submit_ajax.ashx?action=user_address_edit&id={model.id}">
        <div class="weui-panel weui-panel_access" style="margin-top:10px;">
            <div class="weui-panel__hd">编辑地址</div>
            <div class="weui-panel__bd">
                <div class="weui-cells_form form-box">
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">收件人</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input id="txtAcceptName" name="txtAcceptName" class="weui-input" type="text" value="{model.accept_name}" placeholder="收件人名称" data-validate="s" />
                        </div>
                    </div>
                    
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">所属地区</label>
                        </div>
                        <div class="weui-cell__bd">
                            <select id="txtProvince" name="txtProvince" class="select"></select>
                            <select id="txtCity" name="txtCity" class="select"></select>
                            <select id="txtArea" name="txtArea" class="select" data-validate="select"></select>
                        </div>
                    </div>
                    
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">详细地址</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input id="txtAddress" name="txtAddress" class="weui-input" type="text" value="{model.address}" placeholder="详细地址" data-validate="s" />
                        </div>
                    </div>
                    
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">手机号</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input id="txtMobile" name="txtMobile" class="weui-input" type="tel" value="{model.mobile}" placeholder="请输入手机号" data-validate="m" />
                        </div>
                    </div>
                    
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">电话</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input id="txtTelphone" name="txtTelphone" class="weui-input" type="text" value="{model.telphone}" placeholder="电话号码，非必填" />
                        </div>
                    </div>
                    
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">邮箱</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input id="txtEmail" name="txtEmail" class="weui-input" type="text" value="{model.email}" placeholder="方便通知，非必填" />
                        </div>
                    </div>
                    
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">邮政编码</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input id="txtPostCode" name="txtPostCode" class="weui-input" type="text" value="{model.post_code}" placeholder="邮政编码，非必填" />
                        </div>
                    </div>
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">验证码</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input id="txtCode" name="txtCode" class="weui-input" type="text" placeholder="请输入验证码" data-validate="code" />
                        </div>
                        <div class="weui-cell__ft">
                            <a href="javascript:;" onclick="ToggleCode(this, '{config.webpath}tools/verify_code.ashx');return false;">
                            <img class="weui-vcode-img" src="{config.webpath}tools/verify_code.ashx" style="width:82px;height:24px;" />
                            </a>
                        </div>
                    </div>
                </div>
                
            </div>
        </div>
        
        <div class="weui-btn-area">
            <input id="btnSubmit" name="btnSubmit" type="submit" class="weui-btn weui-btn_primary" value="确认提交" />
        </div>
        </form>
        <!--/编辑地址-->
        
        <%else%>
        <!--新增地址-->
        <script type="text/javascript">
            $(function(){
                //初始化地区
                var mypcas = new PCAS("txtProvince,所属省份", "txtCity,所属城市", "txtArea,所属地区");
            });
        </script>
        <form id="editForm" name="editForm" class="form-box" url="{config.webpath}tools/submit_ajax.ashx?action=user_address_edit">
        <div class="weui-panel weui-panel_access" style="margin-top:10px;">
            <div class="weui-panel__hd">新增地址</div>
            <div class="weui-panel__bd">
                <div class="weui-cells_form form-box">
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">收件人</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input id="txtAcceptName" name="txtAcceptName" class="weui-input" type="text" placeholder="收件人名称" data-validate="s" />
                        </div>
                    </div>
                    
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">所属地区</label>
                        </div>
                        <div class="weui-cell__bd">
                            <select id="txtProvince" name="txtProvince" class="select"></select>
                            <select id="txtCity" name="txtCity" class="select"></select>
                            <select id="txtArea" name="txtArea" class="select" data-validate="select"></select>
                        </div>
                    </div>
                    
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">详细地址</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input id="txtAddress" name="txtAddress" class="weui-input" type="text" placeholder="详细地址" data-validate="s" />
                        </div>
                    </div>
                    
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">手机号</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input id="txtMobile" name="txtMobile" class="weui-input" type="tel" placeholder="请输入手机号" data-validate="m" />
                        </div>
                    </div>
                    
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">电话</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input id="txtTelphone" name="txtTelphone" class="weui-input" type="text" placeholder="电话号码，非必填" />
                        </div>
                    </div>
                    
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">邮箱</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input id="txtEmail" name="txtEmail" class="weui-input" type="text" placeholder="方便通知，非必填" />
                        </div>
                    </div>
                    
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">邮政编码</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input id="txtPostCode" name="txtPostCode" class="weui-input" type="text" placeholder="邮政编码，非必填" />
                        </div>
                    </div>
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">验证码</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input id="txtCode" name="txtCode" class="weui-input" type="text" placeholder="请输入验证码" data-validate="code" />
                        </div>
                        <div class="weui-cell__ft">
                            <a href="javascript:;" onclick="ToggleCode(this, '{config.webpath}tools/verify_code.ashx');return false;">
                            <img class="weui-vcode-img" src="{config.webpath}tools/verify_code.ashx" style="width:82px;height:24px;" />
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="weui-btn-area">
            <input id="btnSubmit" name="btnSubmit" type="submit" class="weui-btn weui-btn_primary" value="确认提交" />
        </div>
        </form>
        <!--/新增地址-->
        <%/if%>
        
        <input id="turl" type="hidden" value="<%linkurl("useraddress")%>" /><!--存在跳转的URL值-->
        
        <!--版权信息-->
        <%template src="_copyright.html"%>
        <!--/版权信息-->

        <!--底部导航-->
        <%template src="_footer.html"%>
        <!--/底部导航-->
    
  </div>
  <!--/页面内容-->

</div>
</body>
</html>
